<!-- HTML header for doxygen 1.8.20-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=9"/>
	<meta name="generator" content="Doxygen 1.9.4"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>Raspberry Pi Pico SDK: include/hardware/divider.h Source File</title>
	<!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="dynsections.js"></script>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
	<link href="doxygen.css" rel="stylesheet" type="text/css" />
	<link href="normalise.css" rel="stylesheet" type="text/css"/>
<link href="main.css" rel="stylesheet" type="text/css"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
	<div class="navigation-mobile">
		<div class="logo--mobile">
			<a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
		</div>
		<div class="navigation-toggle">
			<span class="line-1"></span>
			<span class="line-2">
				<p>Menu Toggle</p>
			</span>
			<span class="line-3"></span>
		</div>
	</div>
	<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
		<div class="logo">
			<a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
			<span style="display: inline-block; margin-top: 10px;">
				v2.0.0
			</span>
		</div>
		<div class="navigation-footer">
			<img src="logo-mobile.svg" alt="Raspberry Pi">
			<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
		</div>
<!-- 		<div class="search">
			<form>
				<input type="search" name="search" id="search" placeholder="Search">
				<input type="submit" value="Search">
			</form>
		</div> -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('rp2__common_2hardware__divider_2include_2hardware_2divider_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">divider.h</div></div>
</div><!--header-->
<div class="contents">
<a href="rp2__common_2hardware__divider_2include_2hardware_2divider_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/*</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="comment"> * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="comment"> *</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="comment"> * SPDX-License-Identifier: BSD-3-Clause</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="comment"> */</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="preprocessor">#ifndef _HARDWARE_DIVIDER_H</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#define _HARDWARE_DIVIDER_H</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &quot;<a class="code" href="pico_8h.html">pico.h</a>&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span> </div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span><span class="preprocessor">#if HAS_SIO_DIVIDER</span></div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span><span class="preprocessor">#include &quot;hardware/structs/sio.h&quot;</span></div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span><span class="preprocessor">#define PICO_EMULATE_DIVIDER 1</span></div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span><span class="keyword">typedef</span> uint64_t divmod_result_t;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span> </div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span><span class="preprocessor">#if PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span><span class="keyword">extern</span> divmod_result_t hw_divider_results[NUM_CORES];</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span> </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __sign_of(int32_t v) {</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>    <span class="keywordflow">return</span> v &gt; 0 ? 1 : (v &lt; 0 ? -1 : 0);</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span>}</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>divmod_result_t <a class="code hl_function" href="group__hardware__divider.html#ga806e168e895d53a3c261ba3e95ed2639">hw_divider_divmod_s32</a>(int32_t a, int32_t b);</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga806e168e895d53a3c261ba3e95ed2639">   74</a></span><span class="keyword">static</span> <span class="keyword">inline</span> divmod_result_t <a class="code hl_function" href="group__hardware__divider.html#ga806e168e895d53a3c261ba3e95ed2639">hw_divider_divmod_s32</a>(int32_t a, int32_t b) {</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>    <span class="keywordflow">if</span> (!b) <span class="keywordflow">return</span> (((uint64_t)a)&lt;&lt;32u) | (uint32_t)(-__sign_of(a));</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>    <span class="keywordflow">return</span> (((uint64_t)(a%b))&lt;&lt;32u) | (uint32_t)(a/b);</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>}</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span> </div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno">   90</span>divmod_result_t <a class="code hl_function" href="group__hardware__divider.html#gac2f4fea8c3ef19a04e574f64f5f520c2">hw_divider_divmod_u32</a>(uint32_t a, uint32_t b);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gac2f4fea8c3ef19a04e574f64f5f520c2">   92</a></span><span class="keyword">static</span> <span class="keyword">inline</span> divmod_result_t <a class="code hl_function" href="group__hardware__divider.html#gac2f4fea8c3ef19a04e574f64f5f520c2">hw_divider_divmod_u32</a>(uint32_t a, uint32_t b)  {</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>    <span class="keywordflow">if</span> (!b) <span class="keywordflow">return</span> (((uint64_t)a)&lt;&lt;32u) | (uint32_t)(-1); <span class="comment">// todo check this</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>    <span class="keywordflow">return</span> (((uint64_t)(a%b))&lt;&lt;32u) | (a/b);</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>}</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span> </div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga3388fa85b0c81ee403a3e5bb34dc7274">  107</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#ga3388fa85b0c81ee403a3e5bb34dc7274">hw_divider_divmod_s32_start</a>(int32_t a, int32_t b) {</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>    check_hw_layout( <a class="code hl_struct" href="structsio__hw__t.html">sio_hw_t</a>, div_sdividend, SIO_DIV_SDIVIDEND_OFFSET);</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>    sio_hw-&gt;div_sdividend = (uint32_t)a;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span>    sio_hw-&gt;div_sdivisor = (uint32_t)b;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span>    <a class="code hl_function" href="group__hardware__divider.html#ga806e168e895d53a3c261ba3e95ed2639">hw_divider_divmod_s32</a>(a, b);</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span>}</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span> </div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga30b74e3742fbd3aeb6dfca568e8d0ae4">  126</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#ga30b74e3742fbd3aeb6dfca568e8d0ae4">hw_divider_divmod_u32_start</a>(uint32_t a, uint32_t b) {</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span>    check_hw_layout(</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span>            <a class="code hl_struct" href="structsio__hw__t.html">sio_hw_t</a>, div_udividend, SIO_DIV_UDIVIDEND_OFFSET);</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span>    sio_hw-&gt;div_udividend = a;</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span>    sio_hw-&gt;div_udivisor = b;</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno">  132</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>    <a class="code hl_function" href="group__hardware__divider.html#gac2f4fea8c3ef19a04e574f64f5f520c2">hw_divider_divmod_u32</a>(a, b);</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>}</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span> </div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">  142</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">hw_divider_wait_ready</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno">  143</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span>    <span class="comment">// this is #1 in lsr below</span></div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span>    <span class="keyword">static_assert</span>(SIO_DIV_CSR_READY_BITS == 1, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span> </div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span>    <span class="comment">// we use one less register and instruction than gcc which uses a TST instruction</span></div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span> </div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span>    uint32_t tmp; <span class="comment">// allow compiler to pick scratch register</span></div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span>    pico_default_asm_volatile (</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno">  151</span>    <span class="stringliteral">&quot;hw_divider_result_loop_%=:&quot;</span></div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span>    <span class="stringliteral">&quot;ldr %0, [%1, %2]\n\t&quot;</span></div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span>    <span class="stringliteral">&quot;lsrs %0, %0, #1\n\t&quot;</span></div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span>    <span class="stringliteral">&quot;bcc hw_divider_result_loop_%=\n\t&quot;</span></div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span>    : <span class="stringliteral">&quot;=&amp;l&quot;</span> (tmp)</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span>    : <span class="stringliteral">&quot;l&quot;</span> (sio_hw), <span class="stringliteral">&quot;I&quot;</span> (SIO_DIV_CSR_OFFSET)</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno">  157</span>    : <span class="stringliteral">&quot;cc&quot;</span></div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno">  158</span>    );</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno">  159</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno">  160</span>}</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno">  161</span> </div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga57310adb7901fb25ee82370130834e1d">  169</a></span><span class="keyword">static</span> <span class="keyword">inline</span> divmod_result_t <a class="code hl_function" href="group__hardware__divider.html#ga57310adb7901fb25ee82370130834e1d">hw_divider_result_nowait</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span>    <span class="comment">// as ugly as this looks it is actually quite efficient</span></div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span>    divmod_result_t rc = ((divmod_result_t) sio_hw-&gt;div_remainder) &lt;&lt; 32u;</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span>    rc |= sio_hw-&gt;div_quotient;</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno">  176</span>    <span class="keywordflow">return</span> hw_divider_results[<a class="code hl_function" href="group__pico__platform.html#ga58434ad816f519308ee02c639b7965bc">get_core_num</a>()];</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span>}</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno">  179</span> </div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gac1fa72fbead3c6737dfcb4dd7b3db6ed">  187</a></span><span class="keyword">static</span> <span class="keyword">inline</span> divmod_result_t <a class="code hl_function" href="group__hardware__divider.html#gac1fa72fbead3c6737dfcb4dd7b3db6ed">hw_divider_result_wait</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno">  188</span>    <a class="code hl_function" href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">hw_divider_wait_ready</a>();</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno">  189</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga57310adb7901fb25ee82370130834e1d">hw_divider_result_nowait</a>();</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno">  190</span>}</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno">  191</span> </div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga21752b8ee127370df37cd9a9e4e4050e">  198</a></span><span class="keyword">inline</span> <span class="keyword">static</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#ga21752b8ee127370df37cd9a9e4e4050e">to_quotient_u32</a>(divmod_result_t r) {</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span>    <span class="keywordflow">return</span> (uint32_t) r;</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno">  200</span>}</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno">  201</span> </div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga62820b8678505f5ea007cedd012da0aa">  208</a></span><span class="keyword">inline</span> <span class="keyword">static</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#ga62820b8678505f5ea007cedd012da0aa">to_quotient_s32</a>(divmod_result_t r) {</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span>    <span class="keywordflow">return</span> (int32_t)(uint32_t)r;</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span>}</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span> </div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gaea3762e4a27f1e42f8e03e6607917462">  220</a></span><span class="keyword">inline</span> <span class="keyword">static</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#gaea3762e4a27f1e42f8e03e6607917462">to_remainder_u32</a>(divmod_result_t r) {</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno">  221</span>    <span class="keywordflow">return</span> (uint32_t)(r &gt;&gt; 32u);</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno">  222</span>}</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno">  223</span> </div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga7ca08fd8fd1961ee25233d4587067178">  232</a></span><span class="keyword">inline</span> <span class="keyword">static</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#ga7ca08fd8fd1961ee25233d4587067178">to_remainder_s32</a>(divmod_result_t r) {</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno">  233</span>    <span class="keywordflow">return</span> (int32_t)(r &gt;&gt; 32u);</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno">  234</span>}</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno">  235</span> </div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno">  236</span> </div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga56d6c26b06211b6f6ae3069b2c612562">  244</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#ga56d6c26b06211b6f6ae3069b2c612562">hw_divider_u32_quotient_wait</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno">  245</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno">  246</span>    <a class="code hl_function" href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">hw_divider_wait_ready</a>();</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno">  247</span>    <span class="keywordflow">return</span> sio_hw-&gt;div_quotient;</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno">  248</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno">  249</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga21752b8ee127370df37cd9a9e4e4050e">to_quotient_u32</a>(<a class="code hl_function" href="group__hardware__divider.html#gac1fa72fbead3c6737dfcb4dd7b3db6ed">hw_divider_result_wait</a>());</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno">  250</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno">  251</span>}</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno">  252</span> </div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gab10a183b8e7bd77ae20a811a4265ea56">  260</a></span><span class="keyword">static</span> <span class="keyword">inline</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#gab10a183b8e7bd77ae20a811a4265ea56">hw_divider_s32_quotient_wait</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno">  261</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno">  262</span>    <a class="code hl_function" href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">hw_divider_wait_ready</a>();</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno">  263</span>    <span class="keywordflow">return</span> (int32_t)sio_hw-&gt;div_quotient;</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno">  264</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno">  265</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga62820b8678505f5ea007cedd012da0aa">to_quotient_s32</a>(<a class="code hl_function" href="group__hardware__divider.html#gac1fa72fbead3c6737dfcb4dd7b3db6ed">hw_divider_result_wait</a>());</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno">  266</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno">  267</span>}</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno">  268</span> </div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga2e23739484aa748a5900d215d279acdf">  276</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#ga2e23739484aa748a5900d215d279acdf">hw_divider_u32_remainder_wait</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno">  277</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno">  278</span>    <a class="code hl_function" href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">hw_divider_wait_ready</a>();</div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno">  279</span>    uint32_t rc = sio_hw-&gt;div_remainder;</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno">  280</span>    sio_hw-&gt;div_quotient; <span class="comment">// must read quotient to cooperate with other SDK code</span></div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno">  281</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno">  282</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno">  283</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#gaea3762e4a27f1e42f8e03e6607917462">to_remainder_u32</a>(<a class="code hl_function" href="group__hardware__divider.html#gac1fa72fbead3c6737dfcb4dd7b3db6ed">hw_divider_result_wait</a>());</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno">  284</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno">  285</span>}</div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno">  286</span> </div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gad2e7f31926e286544a8d47fdf8131eb5">  294</a></span><span class="keyword">static</span> <span class="keyword">inline</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#gad2e7f31926e286544a8d47fdf8131eb5">hw_divider_s32_remainder_wait</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno">  295</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno">  296</span>    <a class="code hl_function" href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">hw_divider_wait_ready</a>();</div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno">  297</span>    int32_t rc = (int32_t)sio_hw-&gt;div_remainder;</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno">  298</span>    sio_hw-&gt;div_quotient; <span class="comment">// must read quotient to cooperate with other SDK code</span></div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno">  299</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno">  300</span>#<span class="keywordflow">else</span></div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno">  301</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga7ca08fd8fd1961ee25233d4587067178">to_remainder_s32</a>(<a class="code hl_function" href="group__hardware__divider.html#gac1fa72fbead3c6737dfcb4dd7b3db6ed">hw_divider_result_wait</a>());</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno">  302</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno">  303</span>}</div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno">  304</span> </div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga8f8f25f9f8feefb588fefed9992e180b">  314</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#ga8f8f25f9f8feefb588fefed9992e180b">hw_divider_u32_quotient</a>(uint32_t a, uint32_t b) {</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno">  315</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno">  316</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga21752b8ee127370df37cd9a9e4e4050e">to_quotient_u32</a>(<a class="code hl_function" href="group__hardware__divider.html#gac2f4fea8c3ef19a04e574f64f5f520c2">hw_divider_divmod_u32</a>(a, b));</div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno">  317</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno">  318</span>    <span class="keywordflow">return</span> b ? (a / b) : (uint32_t)(-1);</div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno">  319</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno">  320</span>}</div>
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno">  321</span> </div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gaa9fec9c4204fb6f874f660b529190d96">  331</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#gaa9fec9c4204fb6f874f660b529190d96">hw_divider_u32_remainder</a>(uint32_t a, uint32_t b) {</div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno">  332</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00333" name="l00333"></a><span class="lineno">  333</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#gaea3762e4a27f1e42f8e03e6607917462">to_remainder_u32</a>(<a class="code hl_function" href="group__hardware__divider.html#gac2f4fea8c3ef19a04e574f64f5f520c2">hw_divider_divmod_u32</a>(a, b));</div>
<div class="line"><a id="l00334" name="l00334"></a><span class="lineno">  334</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00335" name="l00335"></a><span class="lineno">  335</span>    <span class="keywordflow">return</span> b ? (a % b) : a;</div>
<div class="line"><a id="l00336" name="l00336"></a><span class="lineno">  336</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00337" name="l00337"></a><span class="lineno">  337</span>}</div>
<div class="line"><a id="l00338" name="l00338"></a><span class="lineno">  338</span> </div>
<div class="line"><a id="l00348" name="l00348"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga1a4e287ce14e27ad959f30e16ee17e4f">  348</a></span><span class="keyword">static</span> <span class="keyword">inline</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#ga1a4e287ce14e27ad959f30e16ee17e4f">hw_divider_quotient_s32</a>(int32_t a, int32_t b) {</div>
<div class="line"><a id="l00349" name="l00349"></a><span class="lineno">  349</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00350" name="l00350"></a><span class="lineno">  350</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga62820b8678505f5ea007cedd012da0aa">to_quotient_s32</a>(<a class="code hl_function" href="group__hardware__divider.html#ga806e168e895d53a3c261ba3e95ed2639">hw_divider_divmod_s32</a>(a, b));</div>
<div class="line"><a id="l00351" name="l00351"></a><span class="lineno">  351</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00352" name="l00352"></a><span class="lineno">  352</span>    <span class="keywordflow">return</span> b ? (a / b) : -1;</div>
<div class="line"><a id="l00353" name="l00353"></a><span class="lineno">  353</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00354" name="l00354"></a><span class="lineno">  354</span>}</div>
<div class="line"><a id="l00355" name="l00355"></a><span class="lineno">  355</span> </div>
<div class="line"><a id="l00365" name="l00365"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga41fe9c9d7dd1e9638ec5dd724698adad">  365</a></span><span class="keyword">static</span> <span class="keyword">inline</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#ga41fe9c9d7dd1e9638ec5dd724698adad">hw_divider_remainder_s32</a>(int32_t a, int32_t b) {</div>
<div class="line"><a id="l00366" name="l00366"></a><span class="lineno">  366</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00367" name="l00367"></a><span class="lineno">  367</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga7ca08fd8fd1961ee25233d4587067178">to_remainder_s32</a>(<a class="code hl_function" href="group__hardware__divider.html#ga806e168e895d53a3c261ba3e95ed2639">hw_divider_divmod_s32</a>(a, b));</div>
<div class="line"><a id="l00368" name="l00368"></a><span class="lineno">  368</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00369" name="l00369"></a><span class="lineno">  369</span>    <span class="keywordflow">return</span> b ? (a % b) : a;</div>
<div class="line"><a id="l00370" name="l00370"></a><span class="lineno">  370</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00371" name="l00371"></a><span class="lineno">  371</span>}</div>
<div class="line"><a id="l00372" name="l00372"></a><span class="lineno">  372</span> </div>
<div class="line"><a id="l00376" name="l00376"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gac9751d0cb261941773c083d1e79569e3">  376</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#gac9751d0cb261941773c083d1e79569e3">hw_divider_pause</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00377" name="l00377"></a><span class="lineno">  377</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00378" name="l00378"></a><span class="lineno">  378</span>    pico_default_asm_volatile(</div>
<div class="line"><a id="l00379" name="l00379"></a><span class="lineno">  379</span>    <span class="stringliteral">&quot;b _1_%=\n&quot;</span></div>
<div class="line"><a id="l00380" name="l00380"></a><span class="lineno">  380</span>    <span class="stringliteral">&quot;_1_%=:\n&quot;</span></div>
<div class="line"><a id="l00381" name="l00381"></a><span class="lineno">  381</span>    <span class="stringliteral">&quot;b _2_%=\n&quot;</span></div>
<div class="line"><a id="l00382" name="l00382"></a><span class="lineno">  382</span>    <span class="stringliteral">&quot;_2_%=:\n&quot;</span></div>
<div class="line"><a id="l00383" name="l00383"></a><span class="lineno">  383</span>    <span class="stringliteral">&quot;b _3_%=\n&quot;</span></div>
<div class="line"><a id="l00384" name="l00384"></a><span class="lineno">  384</span>    <span class="stringliteral">&quot;_3_%=:\n&quot;</span></div>
<div class="line"><a id="l00385" name="l00385"></a><span class="lineno">  385</span>    <span class="stringliteral">&quot;b _4_%=\n&quot;</span></div>
<div class="line"><a id="l00386" name="l00386"></a><span class="lineno">  386</span>    <span class="stringliteral">&quot;_4_%=:\n&quot;</span></div>
<div class="line"><a id="l00387" name="l00387"></a><span class="lineno">  387</span>    :::);</div>
<div class="line"><a id="l00388" name="l00388"></a><span class="lineno">  388</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00389" name="l00389"></a><span class="lineno">  389</span>}</div>
<div class="line"><a id="l00390" name="l00390"></a><span class="lineno">  390</span> </div>
<div class="line"><a id="l00400" name="l00400"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gad18c35723af182a45e044b29cd1e60b2">  400</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#gad18c35723af182a45e044b29cd1e60b2">hw_divider_u32_quotient_inlined</a>(uint32_t a, uint32_t b) {</div>
<div class="line"><a id="l00401" name="l00401"></a><span class="lineno">  401</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00402" name="l00402"></a><span class="lineno">  402</span>    <a class="code hl_function" href="group__hardware__divider.html#ga30b74e3742fbd3aeb6dfca568e8d0ae4">hw_divider_divmod_u32_start</a>(a, b);</div>
<div class="line"><a id="l00403" name="l00403"></a><span class="lineno">  403</span>    <a class="code hl_function" href="group__hardware__divider.html#gac9751d0cb261941773c083d1e79569e3">hw_divider_pause</a>();</div>
<div class="line"><a id="l00404" name="l00404"></a><span class="lineno">  404</span>    <span class="keywordflow">return</span> sio_hw-&gt;div_quotient;</div>
<div class="line"><a id="l00405" name="l00405"></a><span class="lineno">  405</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00406" name="l00406"></a><span class="lineno">  406</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga8f8f25f9f8feefb588fefed9992e180b">hw_divider_u32_quotient</a>(a,b);</div>
<div class="line"><a id="l00407" name="l00407"></a><span class="lineno">  407</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00408" name="l00408"></a><span class="lineno">  408</span>}</div>
<div class="line"><a id="l00409" name="l00409"></a><span class="lineno">  409</span> </div>
<div class="line"><a id="l00419" name="l00419"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga46f7b5751556b7b1d5600561160abb3c">  419</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code hl_function" href="group__hardware__divider.html#ga46f7b5751556b7b1d5600561160abb3c">hw_divider_u32_remainder_inlined</a>(uint32_t a, uint32_t b) {</div>
<div class="line"><a id="l00420" name="l00420"></a><span class="lineno">  420</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00421" name="l00421"></a><span class="lineno">  421</span>    <a class="code hl_function" href="group__hardware__divider.html#ga30b74e3742fbd3aeb6dfca568e8d0ae4">hw_divider_divmod_u32_start</a>(a, b);</div>
<div class="line"><a id="l00422" name="l00422"></a><span class="lineno">  422</span>    <a class="code hl_function" href="group__hardware__divider.html#gac9751d0cb261941773c083d1e79569e3">hw_divider_pause</a>();</div>
<div class="line"><a id="l00423" name="l00423"></a><span class="lineno">  423</span>    uint32_t rc = sio_hw-&gt;div_remainder;</div>
<div class="line"><a id="l00424" name="l00424"></a><span class="lineno">  424</span>    sio_hw-&gt;div_quotient; <span class="comment">// must read quotient to cooperate with other SDK code</span></div>
<div class="line"><a id="l00425" name="l00425"></a><span class="lineno">  425</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00426" name="l00426"></a><span class="lineno">  426</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00427" name="l00427"></a><span class="lineno">  427</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#gaa9fec9c4204fb6f874f660b529190d96">hw_divider_u32_remainder</a>(a,b);</div>
<div class="line"><a id="l00428" name="l00428"></a><span class="lineno">  428</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00429" name="l00429"></a><span class="lineno">  429</span>}</div>
<div class="line"><a id="l00430" name="l00430"></a><span class="lineno">  430</span> </div>
<div class="line"><a id="l00440" name="l00440"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga23a3a2a911f5d78bb56799969b079f94">  440</a></span><span class="keyword">static</span> <span class="keyword">inline</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#ga23a3a2a911f5d78bb56799969b079f94">hw_divider_s32_quotient_inlined</a>(int32_t a, int32_t b) {</div>
<div class="line"><a id="l00441" name="l00441"></a><span class="lineno">  441</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00442" name="l00442"></a><span class="lineno">  442</span>    <a class="code hl_function" href="group__hardware__divider.html#ga3388fa85b0c81ee403a3e5bb34dc7274">hw_divider_divmod_s32_start</a>(a, b);</div>
<div class="line"><a id="l00443" name="l00443"></a><span class="lineno">  443</span>    <a class="code hl_function" href="group__hardware__divider.html#gac9751d0cb261941773c083d1e79569e3">hw_divider_pause</a>();</div>
<div class="line"><a id="l00444" name="l00444"></a><span class="lineno">  444</span>    <span class="keywordflow">return</span> (int32_t)sio_hw-&gt;div_quotient;</div>
<div class="line"><a id="l00445" name="l00445"></a><span class="lineno">  445</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00446" name="l00446"></a><span class="lineno">  446</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga1a4e287ce14e27ad959f30e16ee17e4f">hw_divider_quotient_s32</a>(a,b);</div>
<div class="line"><a id="l00447" name="l00447"></a><span class="lineno">  447</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00448" name="l00448"></a><span class="lineno">  448</span>}</div>
<div class="line"><a id="l00449" name="l00449"></a><span class="lineno">  449</span> </div>
<div class="line"><a id="l00459" name="l00459"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#ga82f0cdc6ef9e74346c0af8e492a0eb8d">  459</a></span><span class="keyword">static</span> <span class="keyword">inline</span> int32_t <a class="code hl_function" href="group__hardware__divider.html#ga82f0cdc6ef9e74346c0af8e492a0eb8d">hw_divider_s32_remainder_inlined</a>(int32_t a, int32_t b) {</div>
<div class="line"><a id="l00460" name="l00460"></a><span class="lineno">  460</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00461" name="l00461"></a><span class="lineno">  461</span>    <a class="code hl_function" href="group__hardware__divider.html#ga3388fa85b0c81ee403a3e5bb34dc7274">hw_divider_divmod_s32_start</a>(a, b);</div>
<div class="line"><a id="l00462" name="l00462"></a><span class="lineno">  462</span>    <a class="code hl_function" href="group__hardware__divider.html#gac9751d0cb261941773c083d1e79569e3">hw_divider_pause</a>();</div>
<div class="line"><a id="l00463" name="l00463"></a><span class="lineno">  463</span>    int32_t rc = (int32_t)sio_hw-&gt;div_remainder;</div>
<div class="line"><a id="l00464" name="l00464"></a><span class="lineno">  464</span>    sio_hw-&gt;div_quotient; <span class="comment">// must read quotient to cooperate with other SDK code</span></div>
<div class="line"><a id="l00465" name="l00465"></a><span class="lineno">  465</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00466" name="l00466"></a><span class="lineno">  466</span>#<span class="keywordflow">else</span></div>
<div class="line"><a id="l00467" name="l00467"></a><span class="lineno">  467</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__divider.html#ga41fe9c9d7dd1e9638ec5dd724698adad">hw_divider_remainder_s32</a>(a,b);</div>
<div class="line"><a id="l00468" name="l00468"></a><span class="lineno">  468</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00469" name="l00469"></a><span class="lineno">  469</span>}</div>
<div class="line"><a id="l00470" name="l00470"></a><span class="lineno">  470</span> </div>
<div class="line"><a id="l00471" name="l00471"></a><span class="lineno">  471</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00472" name="l00472"></a><span class="lineno">  472</span><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a id="l00473" name="l00473"></a><span class="lineno">  473</span>    uint32_t values[4];</div>
<div class="line"><a id="l00474" name="l00474"></a><span class="lineno">  474</span>} hw_divider_state_t;</div>
<div class="line"><a id="l00475" name="l00475"></a><span class="lineno">  475</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00476" name="l00476"></a><span class="lineno">  476</span><span class="keyword">typedef</span> uint64_t hw_divider_state_t;</div>
<div class="line"><a id="l00477" name="l00477"></a><span class="lineno">  477</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00478" name="l00478"></a><span class="lineno">  478</span> </div>
<div class="line"><a id="l00488" name="l00488"></a><span class="lineno">  488</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00489" name="l00489"></a><span class="lineno">  489</span><span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#gac12f398a163e90ca4d52386bd7e161b9">hw_divider_save_state</a>(hw_divider_state_t *dest);</div>
<div class="line"><a id="l00490" name="l00490"></a><span class="lineno">  490</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00491" name="l00491"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gac12f398a163e90ca4d52386bd7e161b9">  491</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#gac12f398a163e90ca4d52386bd7e161b9">hw_divider_save_state</a>(hw_divider_state_t *dest) {</div>
<div class="line"><a id="l00492" name="l00492"></a><span class="lineno">  492</span>    *dest = hw_divider_results[<a class="code hl_function" href="group__pico__platform.html#ga58434ad816f519308ee02c639b7965bc">get_core_num</a>()];</div>
<div class="line"><a id="l00493" name="l00493"></a><span class="lineno">  493</span>}</div>
<div class="line"><a id="l00494" name="l00494"></a><span class="lineno">  494</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00495" name="l00495"></a><span class="lineno">  495</span> </div>
<div class="line"><a id="l00503" name="l00503"></a><span class="lineno">  503</span><span class="preprocessor">#if !PICO_EMULATE_DIVIDER</span></div>
<div class="line"><a id="l00504" name="l00504"></a><span class="lineno">  504</span><span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#gaa8efb2ea90ef78f863b1c518c5824002">hw_divider_restore_state</a>(hw_divider_state_t *src);</div>
<div class="line"><a id="l00505" name="l00505"></a><span class="lineno">  505</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00506" name="l00506"></a><span class="lineno"><a class="line" href="group__hardware__divider.html#gaa8efb2ea90ef78f863b1c518c5824002">  506</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__divider.html#gaa8efb2ea90ef78f863b1c518c5824002">hw_divider_restore_state</a>(hw_divider_state_t *src) {</div>
<div class="line"><a id="l00507" name="l00507"></a><span class="lineno">  507</span>    hw_divider_results[<a class="code hl_function" href="group__pico__platform.html#ga58434ad816f519308ee02c639b7965bc">get_core_num</a>()] = *src;</div>
<div class="line"><a id="l00508" name="l00508"></a><span class="lineno">  508</span>}</div>
<div class="line"><a id="l00509" name="l00509"></a><span class="lineno">  509</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00510" name="l00510"></a><span class="lineno">  510</span> </div>
<div class="line"><a id="l00511" name="l00511"></a><span class="lineno">  511</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l00512" name="l00512"></a><span class="lineno">  512</span>}</div>
<div class="line"><a id="l00513" name="l00513"></a><span class="lineno">  513</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00514" name="l00514"></a><span class="lineno">  514</span> </div>
<div class="line"><a id="l00515" name="l00515"></a><span class="lineno">  515</span><span class="preprocessor">#endif </span><span class="comment">// _HARDWARE_DIVIDER_H</span></div>
<div class="ttc" id="agroup__hardware__divider_html_ga1a4e287ce14e27ad959f30e16ee17e4f"><div class="ttname"><a href="group__hardware__divider.html#ga1a4e287ce14e27ad959f30e16ee17e4f">hw_divider_quotient_s32</a></div><div class="ttdeci">static int32_t hw_divider_quotient_s32(int32_t a, int32_t b)</div><div class="ttdoc">Do a signed HW divide, wait for result, return quotient.</div><div class="ttdef"><b>Definition:</b> divider.h:348</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga21752b8ee127370df37cd9a9e4e4050e"><div class="ttname"><a href="group__hardware__divider.html#ga21752b8ee127370df37cd9a9e4e4050e">to_quotient_u32</a></div><div class="ttdeci">static uint32_t to_quotient_u32(divmod_result_t r)</div><div class="ttdoc">Efficient extraction of unsigned quotient from 32p32 fixed point.</div><div class="ttdef"><b>Definition:</b> divider.h:198</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga23a3a2a911f5d78bb56799969b079f94"><div class="ttname"><a href="group__hardware__divider.html#ga23a3a2a911f5d78bb56799969b079f94">hw_divider_s32_quotient_inlined</a></div><div class="ttdeci">static int32_t hw_divider_s32_quotient_inlined(int32_t a, int32_t b)</div><div class="ttdoc">Do a hardware signed HW divide, wait for result, return quotient.</div><div class="ttdef"><b>Definition:</b> divider.h:440</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga2e23739484aa748a5900d215d279acdf"><div class="ttname"><a href="group__hardware__divider.html#ga2e23739484aa748a5900d215d279acdf">hw_divider_u32_remainder_wait</a></div><div class="ttdeci">static uint32_t hw_divider_u32_remainder_wait(void)</div><div class="ttdoc">Return result of last asynchronous HW divide, unsigned remainder only.</div><div class="ttdef"><b>Definition:</b> divider.h:276</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga30b74e3742fbd3aeb6dfca568e8d0ae4"><div class="ttname"><a href="group__hardware__divider.html#ga30b74e3742fbd3aeb6dfca568e8d0ae4">hw_divider_divmod_u32_start</a></div><div class="ttdeci">static void hw_divider_divmod_u32_start(uint32_t a, uint32_t b)</div><div class="ttdoc">Start an unsigned asynchronous divide.</div><div class="ttdef"><b>Definition:</b> divider.h:126</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga3388fa85b0c81ee403a3e5bb34dc7274"><div class="ttname"><a href="group__hardware__divider.html#ga3388fa85b0c81ee403a3e5bb34dc7274">hw_divider_divmod_s32_start</a></div><div class="ttdeci">static void hw_divider_divmod_s32_start(int32_t a, int32_t b)</div><div class="ttdoc">Start a signed asynchronous divide.</div><div class="ttdef"><b>Definition:</b> divider.h:107</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga41fe9c9d7dd1e9638ec5dd724698adad"><div class="ttname"><a href="group__hardware__divider.html#ga41fe9c9d7dd1e9638ec5dd724698adad">hw_divider_remainder_s32</a></div><div class="ttdeci">static int32_t hw_divider_remainder_s32(int32_t a, int32_t b)</div><div class="ttdoc">Do a signed HW divide, wait for result, return remainder.</div><div class="ttdef"><b>Definition:</b> divider.h:365</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga46f7b5751556b7b1d5600561160abb3c"><div class="ttname"><a href="group__hardware__divider.html#ga46f7b5751556b7b1d5600561160abb3c">hw_divider_u32_remainder_inlined</a></div><div class="ttdeci">static uint32_t hw_divider_u32_remainder_inlined(uint32_t a, uint32_t b)</div><div class="ttdoc">Do a hardware unsigned HW divide, wait for result, return remainder.</div><div class="ttdef"><b>Definition:</b> divider.h:419</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga56d6c26b06211b6f6ae3069b2c612562"><div class="ttname"><a href="group__hardware__divider.html#ga56d6c26b06211b6f6ae3069b2c612562">hw_divider_u32_quotient_wait</a></div><div class="ttdeci">static uint32_t hw_divider_u32_quotient_wait(void)</div><div class="ttdoc">Return result of last asynchronous HW divide, unsigned quotient only.</div><div class="ttdef"><b>Definition:</b> divider.h:244</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga57310adb7901fb25ee82370130834e1d"><div class="ttname"><a href="group__hardware__divider.html#ga57310adb7901fb25ee82370130834e1d">hw_divider_result_nowait</a></div><div class="ttdeci">static divmod_result_t hw_divider_result_nowait(void)</div><div class="ttdoc">Return result of HW divide, nowait.</div><div class="ttdef"><b>Definition:</b> divider.h:169</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga62820b8678505f5ea007cedd012da0aa"><div class="ttname"><a href="group__hardware__divider.html#ga62820b8678505f5ea007cedd012da0aa">to_quotient_s32</a></div><div class="ttdeci">static int32_t to_quotient_s32(divmod_result_t r)</div><div class="ttdoc">Efficient extraction of signed quotient from 32p32 fixed point.</div><div class="ttdef"><b>Definition:</b> divider.h:208</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga7ca08fd8fd1961ee25233d4587067178"><div class="ttname"><a href="group__hardware__divider.html#ga7ca08fd8fd1961ee25233d4587067178">to_remainder_s32</a></div><div class="ttdeci">static int32_t to_remainder_s32(divmod_result_t r)</div><div class="ttdoc">Efficient extraction of signed remainder from 32p32 fixed point.</div><div class="ttdef"><b>Definition:</b> divider.h:232</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga806e168e895d53a3c261ba3e95ed2639"><div class="ttname"><a href="group__hardware__divider.html#ga806e168e895d53a3c261ba3e95ed2639">hw_divider_divmod_s32</a></div><div class="ttdeci">static divmod_result_t hw_divider_divmod_s32(int32_t a, int32_t b)</div><div class="ttdoc">Do a signed HW divide and wait for result.</div><div class="ttdef"><b>Definition:</b> divider.h:74</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga82cfc7c264f332ad15135158a37821dc"><div class="ttname"><a href="group__hardware__divider.html#ga82cfc7c264f332ad15135158a37821dc">hw_divider_wait_ready</a></div><div class="ttdeci">static void hw_divider_wait_ready(void)</div><div class="ttdoc">Wait for a divide to complete.</div><div class="ttdef"><b>Definition:</b> divider.h:142</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga82f0cdc6ef9e74346c0af8e492a0eb8d"><div class="ttname"><a href="group__hardware__divider.html#ga82f0cdc6ef9e74346c0af8e492a0eb8d">hw_divider_s32_remainder_inlined</a></div><div class="ttdeci">static int32_t hw_divider_s32_remainder_inlined(int32_t a, int32_t b)</div><div class="ttdoc">Do a hardware signed HW divide, wait for result, return remainder.</div><div class="ttdef"><b>Definition:</b> divider.h:459</div></div>
<div class="ttc" id="agroup__hardware__divider_html_ga8f8f25f9f8feefb588fefed9992e180b"><div class="ttname"><a href="group__hardware__divider.html#ga8f8f25f9f8feefb588fefed9992e180b">hw_divider_u32_quotient</a></div><div class="ttdeci">static uint32_t hw_divider_u32_quotient(uint32_t a, uint32_t b)</div><div class="ttdoc">Do an unsigned HW divide, wait for result, return quotient.</div><div class="ttdef"><b>Definition:</b> divider.h:314</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gaa8efb2ea90ef78f863b1c518c5824002"><div class="ttname"><a href="group__hardware__divider.html#gaa8efb2ea90ef78f863b1c518c5824002">hw_divider_restore_state</a></div><div class="ttdeci">static void hw_divider_restore_state(hw_divider_state_t *src)</div><div class="ttdoc">Load a saved hardware divider state into the current core's hardware divider.</div><div class="ttdef"><b>Definition:</b> divider.h:506</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gaa9fec9c4204fb6f874f660b529190d96"><div class="ttname"><a href="group__hardware__divider.html#gaa9fec9c4204fb6f874f660b529190d96">hw_divider_u32_remainder</a></div><div class="ttdeci">static uint32_t hw_divider_u32_remainder(uint32_t a, uint32_t b)</div><div class="ttdoc">Do an unsigned HW divide, wait for result, return remainder.</div><div class="ttdef"><b>Definition:</b> divider.h:331</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gab10a183b8e7bd77ae20a811a4265ea56"><div class="ttname"><a href="group__hardware__divider.html#gab10a183b8e7bd77ae20a811a4265ea56">hw_divider_s32_quotient_wait</a></div><div class="ttdeci">static int32_t hw_divider_s32_quotient_wait(void)</div><div class="ttdoc">Return result of last asynchronous HW divide, signed quotient only.</div><div class="ttdef"><b>Definition:</b> divider.h:260</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gac12f398a163e90ca4d52386bd7e161b9"><div class="ttname"><a href="group__hardware__divider.html#gac12f398a163e90ca4d52386bd7e161b9">hw_divider_save_state</a></div><div class="ttdeci">static void hw_divider_save_state(hw_divider_state_t *dest)</div><div class="ttdoc">Save the calling cores hardware divider state.</div><div class="ttdef"><b>Definition:</b> divider.h:491</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gac1fa72fbead3c6737dfcb4dd7b3db6ed"><div class="ttname"><a href="group__hardware__divider.html#gac1fa72fbead3c6737dfcb4dd7b3db6ed">hw_divider_result_wait</a></div><div class="ttdeci">static divmod_result_t hw_divider_result_wait(void)</div><div class="ttdoc">Return result of last asynchronous HW divide.</div><div class="ttdef"><b>Definition:</b> divider.h:187</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gac2f4fea8c3ef19a04e574f64f5f520c2"><div class="ttname"><a href="group__hardware__divider.html#gac2f4fea8c3ef19a04e574f64f5f520c2">hw_divider_divmod_u32</a></div><div class="ttdeci">static divmod_result_t hw_divider_divmod_u32(uint32_t a, uint32_t b)</div><div class="ttdoc">Do an unsigned HW divide and wait for result.</div><div class="ttdef"><b>Definition:</b> divider.h:92</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gac9751d0cb261941773c083d1e79569e3"><div class="ttname"><a href="group__hardware__divider.html#gac9751d0cb261941773c083d1e79569e3">hw_divider_pause</a></div><div class="ttdeci">static void hw_divider_pause(void)</div><div class="ttdoc">Pause for exact amount of time needed for a asynchronous divide to complete.</div><div class="ttdef"><b>Definition:</b> divider.h:376</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gad18c35723af182a45e044b29cd1e60b2"><div class="ttname"><a href="group__hardware__divider.html#gad18c35723af182a45e044b29cd1e60b2">hw_divider_u32_quotient_inlined</a></div><div class="ttdeci">static uint32_t hw_divider_u32_quotient_inlined(uint32_t a, uint32_t b)</div><div class="ttdoc">Do a hardware unsigned HW divide, wait for result, return quotient.</div><div class="ttdef"><b>Definition:</b> divider.h:400</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gad2e7f31926e286544a8d47fdf8131eb5"><div class="ttname"><a href="group__hardware__divider.html#gad2e7f31926e286544a8d47fdf8131eb5">hw_divider_s32_remainder_wait</a></div><div class="ttdeci">static int32_t hw_divider_s32_remainder_wait(void)</div><div class="ttdoc">Return result of last asynchronous HW divide, signed remainder only.</div><div class="ttdef"><b>Definition:</b> divider.h:294</div></div>
<div class="ttc" id="agroup__hardware__divider_html_gaea3762e4a27f1e42f8e03e6607917462"><div class="ttname"><a href="group__hardware__divider.html#gaea3762e4a27f1e42f8e03e6607917462">to_remainder_u32</a></div><div class="ttdeci">static uint32_t to_remainder_u32(divmod_result_t r)</div><div class="ttdoc">Efficient extraction of unsigned remainder from 32p32 fixed point.</div><div class="ttdef"><b>Definition:</b> divider.h:220</div></div>
<div class="ttc" id="agroup__pico__platform_html_ga58434ad816f519308ee02c639b7965bc"><div class="ttname"><a href="group__pico__platform.html#ga58434ad816f519308ee02c639b7965bc">get_core_num</a></div><div class="ttdeci">static __force_inline uint get_core_num(void)</div><div class="ttdoc">Get the current core number.</div><div class="ttdef"><b>Definition:</b> platform.h:141</div></div>
<div class="ttc" id="apico_8h_html"><div class="ttname"><a href="pico_8h.html">pico.h</a></div></div>
<div class="ttc" id="astructsio__hw__t_html"><div class="ttname"><a href="structsio__hw__t.html">sio_hw_t</a></div><div class="ttdef"><b>Definition:</b> sio.h:28</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->

	<script src="main.js"></script>
</body>
</html>